package com.ljx.offer;

import org.junit.Test;

/**
 * @author 李捷禧
 * Date: 2023/4/2
 * ClassName: C_51
 */

public class C_51 {
    public int reversePairs(int[] nums) {
        int sum = 0;
        for (int i = 0; i < nums.length - 1; i++) {
            for (int j = i; j < nums.length; j++) {
                if(nums[i] > nums[j]) sum++;
            }
        }
        return sum;
    }


    @Test
    public void test(){
        int[] arr = new int[]{7,5,6,4};
        System.out.println(reversePairs(arr));

    }

}
